using System;
using System.Collections.Generic;
using System.Text;

namespace NetSpider.Retrieval
{
    public class FetchQueue : Queue<IFetchRequest>, IFetchQueue
    {
        private FetchQueue()
        {
        }

        public static IFetchQueue Create()
        {
            return new FetchQueue();
        }

        public void PutItem(string uri)
        {
            PutItem(new FetchRequest(uri));
        }

        public void PutItem(IFetchRequest item)
        {
            Enqueue(item);
        }

        public IFetchRequest GetItem()
        {
            return Dequeue();
        }

        public bool HasItems()
        {
            return Count > 0;
        }
    }

    public interface IFetchQueue
    {
        void PutItem(string uri);
        void PutItem(IFetchRequest item);
        IFetchRequest GetItem();
        bool HasItems();
    }
}